package com.cheng.common.utils;

/**
 * @author: ChengJW
 * @date: 2021/11/1 20:00
 * @version: 1.0
 * @description: id 工具类
 */
public class IdUtil {


    /**
    * @author: ChengJW
    * @params: []
    * @return: long
    * @date: 2021/11/2
    * @description: 基本 id 数据
    */
    public static long getBaseId(){
        return System.currentTimeMillis();
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/2
    * @description: 获取 userId
    */
    public static String getUserId(){
        return "U"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/2
    * @description:  获取 roleId
    */
    public static String getRoleId(){
        return "R"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/2
    * @description: 获取 exceptionId
    */
    public static String getExceptionId(){
        return "E"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/6
    * @description: 获取 companyId
    */
    public static String getCompId(){
        return "C"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/29
    * @description: company_info 表 ID
    */
    public static String getCompInfoId(){
        return "CI" + String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/29
    * @description: 业务申请编号
    */
    public static String getBussId(){
        return "KD" + String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/8
    * @description: 获取 受理信息 acceptId
    */
    public static String getAceptId(){
        return "AT"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/11
    * @description: 获取部门id
    */
    public static String getDepId(){
        return "DT"+String.valueOf(getBaseId());
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/14
    * @description: 用户-角色中间表id：规则 ul+时间戳+3位数字
    */
    public static String getULId(int i){
        StringBuilder builder = new StringBuilder("UL"+String.valueOf(getBaseId()));
        if (0 <= i && i <10){
            builder.append("00").append(i);
        }else if (10 < i && i < 100){
            builder.append("0").append(i);
        }else {
            builder.append(i);
        }
        return builder.toString();
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/11/17
    * @description: 角色-权限中间表：规则 rp+时间戳+3位数字
    */
    public static String getRPId(int i){
        StringBuilder builder = new StringBuilder("UL"+String.valueOf(getBaseId()));
        if (0 <= i && i <10){
            builder.append("00").append(i);
        }else if (10 < i && i < 100){
            builder.append("0").append(i);
        }else {
            builder.append(i);
        }
        return builder.toString();
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/12/18
    * @description: 企业迁移信息 ID
    */
    public static String getCMId(){
        return "CM" + getBaseId();
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/12/20
    * @description: 借阅信息表 Id
    */
    public static String getBrowId(){
        return "BW" + getBaseId();
    }

    /**
    * @author: ChengJW
    * @params: []
    * @return: java.lang.String
    * @date: 2021/12/26
    * @description: 获取登录日志 ID
    */
    public static String getLoginId(){
        return "LG" + getBaseId();
    }
}
